package com.bestcem.xm.om.controller.vo;

import com.bestcem.xm.om.entity.OmRole;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author zq.ding <zq.ding@idiaoyan.com>
 * @version v1.0
 * @date 2021/12/24 17:05
 */
@NoArgsConstructor
@Data
public class OmRoleVO {
    @JsonProperty("id")
    private String id;
    @JsonProperty("title")
    private String title;
    @JsonProperty("content")
    private String content;
    @JsonProperty("ttype")
    private Integer ttype;
    @JsonProperty("permissions")
    private String permissions;
    @JsonProperty("createdDT")
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    private LocalDateTime createTime;
    @JsonProperty("updatedDT")
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    private LocalDateTime updateTime;

    public static OmRoleVO convertToVO(OmRole omRole) {
        OmRoleVO omRoleVO = new OmRoleVO();
        omRoleVO.setId(omRole.getId());
        omRoleVO.setTitle(omRole.getTitle());
        omRoleVO.setContent(omRole.getContent());
        omRoleVO.setTtype(omRole.getType());
        omRoleVO.setPermissions(omRole.getPermissions());
        omRoleVO.setCreateTime(omRole.getCreateTime());
        omRoleVO.setUpdateTime(omRole.getUpdateTime());
        return omRoleVO;
    }
}
